

// var a = {
//     name:"小葱",
//     age:function () {
//     a.birth=prompt("请输入你的出生年份");

//     var l=new Date().getFullYear();

//     return l-this.birth
        
//     }   
// }
// console.log(a.age());
// console.log(a);

/*
var bbb={
    name:"小葱",
    age :function(){
        var that=this;
            function getageFromBirth(){

                bbb.birth=prompt("请输入你的出生年份！");
               
                return new Date().getFullYear()-that.birth


            }
            return getageFromBirth()

    },
    alimony:100,
    Getalimony:function (){
        function add(){    
            bbb.alimony=bbb.alimony+Number(prompt("你孩子的生活费不多了，您这个月准备给他多少生活费啊")) 
            return  bbb.alimony
        }
        return add()
    }  
}
//console.log(bbb.Getalimony());
console.log(bbb.Getalimony());
*/


//函数中的apply()
/* 
function getage (){

    return new Date().getFullYear()-this.birth
}


var t={
    name:"小黄",
    birth:2002,
    age:getage
}
 
//getage.apply(t,[])
console.log("你瞅啥呢");

console.log(getage.apply(t,[]));

var w={
    name:"小黄",
    birth:1909,
    age:getage
}
console.log(getage.apply(w,[]));
*/


//call()

Math.max(2,1,5,9,6)
console.log(Math.max(2,1,5,9,6));
console.log(Math.max.apply(null,[2,1,5,9,6,88]));
console.log(Math.max.call(null,2,1,5,9,6,88));








